import 'dart:typed_data';
import 'dart:ui';

import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:full_display/common/qxp_color.dart';
import 'package:full_display/common/qxp_style.dart';
import 'package:full_display/page/single/single_api.dart';
import 'package:full_display/provide/button_list_provider.dart';
import 'package:full_display/provide/time_provider.dart';
import 'package:full_display/unit/screen/screen_utility.dart';
import 'package:full_display/unit/toast/progress_hud.dart';
import 'package:full_display/unit/toast/toast_util.dart';
import 'package:full_display/unit/web_socket/web_sockect_utils.dart';
import 'package:full_display/unit/widgets/widget_button_list.dart';
import 'package:full_display/unit/widgets/widget_dialog/add_clock_dialog.dart';
import 'package:image_picker/image_picker.dart';
import 'package:provider/provider.dart';

typedef OnPickImageCallback = void Function(
    double? maxWidth, double? maxHeight, int? quality);

class AddMediaDialog extends Dialog {
  // Function(XFile) tapAction;
  Function(int index, BuildContext context) tapAction;
  AddMediaDialog({required this.tapAction});
  late ButtonListProvider _btnListData;
  @override
  Widget build(BuildContext context) {
    _btnListData = context.watch<ButtonListProvider>();
    return Material(
      type: MaterialType.transparency,
      child: Center(
        child: Container(
          width: 253.0.W,
          height: 169.0.W,
          decoration: const BoxDecoration(
            gradient: LinearGradient(
                //渐变位置
                begin: Alignment.topCenter, //右上
                end: Alignment.bottomCenter, //左下
                //渐变颜色[始点颜色, 结束颜色]
                colors: [ColorPlate.app_blue, ColorPlate.sub_blue]),
            borderRadius: BorderRadius.all(Radius.circular(8.0)),
          ),
          child: Container(
            child: ButtonListWidget(
                btnList: _btnListData.mediaBtnList,
                tapAction: tapAction,
                isBg: true),
          ),
        ),
      ),
    );
  }
}
